package com.book.oauth.server.user.hystrix;

import com.book.common.result.RestResponse;
import com.book.common.result.PageInfo;
import com.book.oauth.server.user.dto.UserRoleDto;
import com.book.oauth.server.user.vo.UserRoleVo;
import com.book.oauth.server.user.hystrix.impl.UserRoleHystrixImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
/**
 * Description：用户角色关联 Hystrix
 * @Author： leo
 * @CreateDate： 2020-12-31
 * @Email： leo.xiong@suyun360.com
 * Version: 1.0
 */
@FeignClient(value = "oauth-server", fallbackFactory = UserRoleHystrixImpl.class)
public interface IUserRoleHystrix {
    /**
     * 根据ID获取用户角色关联信息
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/server/userRole/{id}", consumes = "application/json")
    RestResponse<UserRoleVo> get(@PathVariable(value = "id") String id);

    /**
     * 查询用户角色关联信息
     *
     * @param userRoleDto
     * @return
     */
    @PostMapping(value = "/server/userRole/list", consumes = "application/json")
    RestResponse<List<UserRoleVo>> list(@RequestBody UserRoleDto userRoleDto);

    /**
     * 查询用户角色关联信息
     *
     * @param userRoleDto
     * @return
     */
    @PostMapping(value = "/server/userRole/page/list", consumes = "application/json")
    RestResponse<PageInfo<UserRoleVo>> pageList(@RequestBody UserRoleDto userRoleDto);

    /**
     * 新增用户角色关联信息
     *
     * @param userRoleDto
     * @return
     */
    @PostMapping(value = "/server/userRole/save", consumes = "application/json")
    RestResponse<String> save(@RequestBody UserRoleDto userRoleDto);

    /**
     * 修改用户角色关联信息
     *
     * @param userRoleDto
     * @return
     */
    @PutMapping(value = "/server/userRole/update", consumes = "application/json")
    RestResponse<String> update(@RequestBody UserRoleDto userRoleDto);

    /**
     * 删除用户角色关联信息
     *
     * @param id
     * @return
     */
    @DeleteMapping(value = "/server/userRole/delete/{id}", consumes = "application/json")
    RestResponse<String> delete(@PathVariable(value = "id") String id);

    /**
     * 导出用户角色关联模板信息
     *
     * @return
     */
    @PostMapping(value = "/server/userRole/export/template", consumes = "application/json")
    RestResponse<String> exportTemplate();

    /**
     * 导出用户角色关联信息
     *
     * @param userRoleDto
     * @return
     */
    @PostMapping(value = "/server/userRole/export/excel", consumes = "application/json")
    RestResponse<String> exportExcel(@RequestBody UserRoleDto userRoleDto);

    /**
     * 导入用户角色关联信息
     *
     * @param filePath
     * @return
     */
    @PostMapping(value = "/server/userRole/import/excel", consumes = "application/json")
    RestResponse<String> importExcel(@RequestParam(value = "filePath") String filePath);

}
